<template>
    <div class="jfMoney">
        <custom-dialog title="确认退费" size="small" @dialogClose="dialogClose">
            <div class="userContent">
                <div class="userItem">
                    <label>账户ID：</label>
                    <span>{{ userInfo.ac_id ?? '--' }}</span>
                </div>
                <div class="userItem">
                    <label>账户名称：</label>
                    <span>{{ userInfo.ac_name ?? '--' }}</span>
                </div>
                <div class="userItem">
                    <label>用户名称：</label>
                    <span>{{ userInfo.user_name ? userInfo.user_name : '--' }}</span>
                </div>
                <div class="userItem">
                    <label>电话：</label>
                    <span>{{ userInfo.user_tel ? userInfo.user_tel : '--' }}</span>
                </div>
                <div class="userItem">
                    <label>邮箱：</label>
                    <span>{{ userInfo.user_email ? userInfo.user_email : '--' }}</span>
                </div>
                <div class="userItem">
                    <label>总剩余金额：</label>
                    <span>{{ userInfo.ac_sum ? parseFloat(userInfo.ac_sum).toFixed(2) : '--' }}</span>
                </div>
                <div class="userItem">
                    <label>免费账户余额：</label>
                    <span>{{ userInfo.free_sum ? parseFloat(userInfo.free_sum).toFixed(2) : '--' }}</span>
                </div>
                <!-- <div class="userItem"> -->
                <!-- <label>免费电余额：</label>
                    <span>{{ userInfo.free_e_sum ? userInfo.free_e_sum : '--' }}</span>
                </div>
                <div class="userItem">
                    <label>免费水余额：</label>
                    <span>{{ userInfo.free_w_sum ? userInfo.free_w_sum : '--' }}</span>
                </div> -->
                <!-- <div class="userItem">
                    <label>透支额度：</label>
                    <span>{{ userInfo.over_sum ? userInfo.over_sum : '--' }}</span>
                </div> -->
                <!-- <div class="userItem">
                    <label>告警金额：</label>
                    <span>{{ userInfo.alarm_sum ? userInfo.alarm_sum : '--' }}</span>
                </div> -->
                <div class="userItem">
                    <label>自缴费剩余金额：</label>
                    <span>{{ userInfo.self_sum ? parseFloat(userInfo.self_sum).toFixed(2) : '--' }}</span>
                </div>
                <div class="userItem">
                    <label>退费金额：</label>
                    <span style="color: red">{{ jfje }}</span
                    >元
                </div>
                <!-- <div class="userItem">
                    <label>账户类型：</label>
                    <span>{{ userInfo.acTypeName ? userInfo.acTypeName : '--' }}</span>
                </div> -->

                <div class="userItem">
                    <label>单价：</label>
                    <span>{{ userInfo.price ? userInfo.price : '--' }}</span>
                </div>
                <div class="userItem">
                    <label>操作人：</label>
                    <span>{{ oprUserName }}</span>
                </div>

                <div class="userItem">
                    <el-button type="primary" @click="print">打印单据</el-button>
                    <el-button type="primary" @click="giveMoeny">确认退费</el-button>
                </div>
            </div>
        </custom-dialog>
    </div>
</template>

<script>
import customDialog from '@/components/customComponents/customDialog'
import {AjaxCommon} from '@/libs/apiCommon'
import {PopupCommon} from '../../../libs/popupCommon'
export default {
    name: 'jfMoney',
    props: ['userInfo', 'jfje', 'oprUserName'],
    components: {customDialog},
    data() {
        return {}
    },
    computed: {},
    created() {},
    methods: {
        print() {},
        giveMoeny() {
            AjaxCommon(
                '/api/Payment/PaymentTf',
                'post',
                {
                    ac_guid: this.userInfo.ac_guid,
                    pay_sum: this.jfje
                },
                true,
                this.jfje
            ).then((res) => {
                if (res.data.Code == 200) {
                    PopupCommon.notify('success', '退费成功：' + res.data.Message)
                    this.dialogClose()
                } else {
                    PopupCommon.notify('error', '退费失败：' + res.data.Message)
                }
            })
        },
        dialogClose() {
            this.$emit('close', '')
        }
    }
}
</script>

<style lang="scss" scoped>
.userItem {
    margin-bottom: 10px;
}
</style>